import javax.swing.*;
import java.awt.*;

/**
 * @Description: to do
 * @Author: songhao
 * @Email:425008064@qq.com
 * @CreateDate: 2019/12/30 13:54
 */
public class JComboBoxDemo {

    public static void main(String[] args) {
        JFrame frame=new JFrame("Java下拉列表组件示例");
        JPanel jp=new JPanel();    //创建面板
        JLabel label1=new JLabel("证件类型：");    //创建标签
        JComboBox cmb=new JComboBox();    //创建JComboBox
        cmb.addItem("--请选择--");    //向下拉列表中添加一项
        cmb.addItem("身份证");
        cmb.addItem("驾驶证");
        cmb.addItem("军官证");
        jp.add(label1);
        jp.add(cmb);

        JPopupTextField jPopupTextField = new JPopupTextField();
        jPopupTextField.setPreferredSize(new Dimension(100,60));

        jp.add(jPopupTextField);

        frame.add(jp);
        frame.setBounds(300,200,400,100);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
